# -*- coding: utf-8 -*-

import numpy as np
import pandas as pd
from sklearn.utils import shuffle

if __name__=='__main__':
    df_all=pd.read_csv('data/cutData/feature_v6.csv')
    df_all=df_all.drop(['sort','label','clickTime','conversionTime',
                             'appCategory'],axis=1).values
    print('feature OK')
    
    df_all_test=pd.read_csv('data/cutData/test_v6.csv')
    feature_all=df_all_test.drop(['label','clickTime','instanceID',
                                  'appCategory'],axis=1).values
    print('test OK')

    train_all=shuffle(df_all,random_state=42)
    train=train_all[0:len(train_all)//10*9]
    cv=train_all[len(train_all)//10*9:]

    train=pd.DataFrame(train)
    cv=pd.DataFrame(cv)

    print('save')
    train.to_csv('data/feature/train.csv')
    cv.to_csv('data/feature/cv.csv')
    df_all_test.to_csv('data/feature/test.csv')
